/**
 * @param {number[]} nums
 * @return {boolean}
 */
export var containsDuplicate = function (nums) {
  const set = new Set()
  for (let i = 0; i < nums.length; i++) {
    if (set.has(nums[i])) {
      return true
    }
    set.add(nums[i])
  }
  return false
}

/**
 * @param {number[]} nums
 * @return {boolean}
 */
export var containsDuplicate2 = function (nums) {
  return new Set(nums).size !== nums.length
}
